package org.flyby.api.daoImpl;

import com.google.common.collect.Maps;
import org.flyby.api.dao.ProductDao;
import org.flyby.api.persistence.Product;
import org.springframework.stereotype.Repository;

import java.util.Map;

@Repository
public class ProductDaoImpl extends BaseCommonDaoImpl<Product> implements ProductDao {

    @Override
    public Product findByBarcode(String barcode) {
        Map<String, Object> parameters = Maps.newHashMap();
        parameters.put("barcode", barcode);
        return executeFirstResultNamedQuery("Product.findByBarcode", parameters);
    }
}
